HTML Form to email via PHP : Multiple Cart Items : Rewrite from ASP

HTML Form to email via PHP : Multiple Cart Items : Rewrite from ASP

am 05.10.2007 06:29:31 von james.n.grace

I am trying to make the contents of a Web visitor's shopping cart
available via email, but can't get anything more than the final item
in their cart to display in the subsequent email. Changing the HTML
form method from the normal "post" to "get" yields the following in
the URL stream (I added carriage returns after each "&" to make things
easier to read):

FromAddress=jgrace%40extensis.com&
ToAddress=jgrace%40extensis.com&
CCAddress=&
BCCAddress=&

FileName=Quick+Start+Guide.pdf&
DirPath=%3A%3AMacBookPro%3APublic%3ADigital+Assets%3AIncomin g
%3A9871263j+-+Special+Project%3AOfficial+Contract%3A&
RIDValue=5525&
Description=Test&

FileName=Slide5.PNG&
DirPath=%3A%3AMacBookPro%3APublic%3ADigital+Assets%3APortfol io
+Presentations%3A8.5%3A&
RIDValue=5520&
Description=slide&

As you can see, the shopping cart items are repeated with the same
"FileName", "DirPath", "RIDValue", and "Description" when they are
sent to the PHP page.


The PHP page which receives the form data is as follows:



- - - - - - - - - - S N I P - - - - - - - - - -



$RIDValue = $_POST['RIDValue'];
$FileName = $_POST['FileName'];
$DirPath = $_POST['DirPath'];
$Description = $_POST['Description'];

$ItemUrl = "http://127.0.0.1/netpub/server.np?
find&catalog=catalog&template=detail.np&field=itemid&op=matc hes&value=" .
$RIDValue . "&site=ecs";
$ThumbUrl = "http://127.0.0.1/netpub/server.np?thumbnail=" .
$RIDValue . "&site=ecs&catalog=catalog";

$Message.= " WIDTH='225'>";
$Message.= " WIDTH='112' BORDER='0' ALT=''>";
$Message.= "";
$Message.= " WIDTH='225'> SIZE='3' COLOR='#ff0000'>" . $RIDValue . "

FACE='Arial,Helvetica,Geneva,Swiss,SunSans-Regular' SIZE='3'
COLOR='#000000'>" . $FileName . "

" . $Description;
$Message.= "
";




- - - - - - - - - - S N I P - - - - - - - - - -


I'm assuming that I have to somehow repeat the above section for each
occurence of "FileName", "DirPath", "RIDValue", and "Description".


I was able to do this quite easily in ASP with the following code:


- - - - - - - - - - S N I P - - - - - - - - - -


intFileCount = 0
for Each SubKey in Request("FileName")
intFileCount = intFileCount + 1
FileName = Request("FileName")(intFileCount)
DirPath = Request("DirPath")(intFileCount)
RIDValue = Request("RIDValue")(intFileCount)
Description = Request("Description")(intFileCount)
ItemUrl = "http://127.0.0.1/netpub/server.np?
find&catalog=catalog&template=detail.np&field=itemid&op=matc hes&value="
& RIDValue & "&site=ecs"
ThumbUrl = "http://127.0.0.1/netpub/server.np?thumbnail=" & RIDValue
& "&site=ecs&catalog=catalog"
strHTML = strHTML & " BGCOLOR=""#ffffff"" WIDTH=""225"">"
strHTML = strHTML & " ThumbUrl & """ WIDTH=""112"" BORDER=""0"" ALT="""">"
strHTML = strHTML & ""
strHTML = strHTML & " BGCOLOR=""#ffffff"" WIDTH=""225""> FACE=""Arial,Helvetica,Geneva,Swiss,SunSans-Regular"" SIZE=""3""
COLOR=""#ff0000"">" & RIDValue & "

FACE=""Arial,Helvetica,Geneva,Swiss,SunSans-Regular"" SIZE=""3""
COLOR=""#000000"">" & FileName & "

" & Description
strHTML = strHTML & "
"
Next

- - - - - - - - - - S N I P - - - - - - - - - -

Anyway, the initial rewrite from ASP to PHP was quite easy.
Unfortunately, the final part is turning out to be much more of a
challenge!

Thanks in advance for your time and effort!

Re: HTML Form to email via PHP : Multiple Cart Items : Rewrite fromASP

am 05.10.2007 14:30:20 von Jerry Stuckle

james.n.grace@gmail.com wrote:
> I am trying to make the contents of a Web visitor's shopping cart
> available via email, but can't get anything more than the final item
> in their cart to display in the subsequent email. Changing the HTML
> form method from the normal "post" to "get" yields the following in
> the URL stream (I added carriage returns after each "&" to make things
> easier to read):
>

First of all, what's the form that's sending the data look like?

It helps to start at the beginning, instead of midway through a problem :-)

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: HTML Form to email via PHP : Multiple Cart Items : Rewrite from ASP

am 05.10.2007 15:43:43 von james.n.grace

The form is very lengthy, but here is the pertinent form code:


- - - - - - - - - - S N I P - - - - - - - - - -